﻿@using System.Web.Optimization
@using HopNguyenCms.Infrastructure
@{
    Layout = null;
    var rawUrl = Request.RawUrl.ToLower();
    List<YouTubeVideoQuality> videos = ViewBag.Video;
}

<!doctype html>
<html itemscope itemtype="http://schema.org/Article">
<head>
    <!-- META TAGS -->
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="Content-Language" content="en" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="robots" content="index, follow" />
    <meta name="author" content="nguyendinhhop91@gmail.com" />
    <link href="https://plus.google.com/106940183329707425010" rel="publisher" />
    <meta property="fb:admins" content="100000293518598" />
    @RenderSection("SEO", false)
    <!-- STYLESHEETS -->
    @Styles.Render("~/bundles/css")
    <!-- JAVASCRIPT -->
    @Scripts.Render("~/bundles/js")
    @Html.Raw(AppSettings.GoogleAnalytics)
    <script>
        (function () {
            var cx = '014648918950938049102:poq5e1litqs';
            var gcse = document.createElement('script');
            gcse.type = 'text/javascript';
            gcse.async = true;
            gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
                '//www.google.com/cse/cse.js?cx=' + cx;
            var s = document.getElementsByTagName('script')[0];
            s.parentNode.insertBefore(gcse, s);
        })();
    </script>
    <!-- FAVICON -->
    <link rel="shortcut icon" href="/frontend/img/favicon.png" />
    <link rel="apple-touch-icon" href="/frontend/img/touch-icon-iphone.png" />
    <link rel="apple-touch-icon" sizes="76x76" href="/frontend/img/touch-icon-ipad.png" />
    <link rel="apple-touch-icon" sizes="120x120" href="/frontend/img/touch-icon-iphone-retina.png" />
    <link rel="apple-touch-icon" sizes="152x152" href="/frontend/img/touch-icon-ipad-retina.png" />
</head>
<body class="has-slider">
    <div id="fb-root"></div>
    <div id="wrapper">
        <header id="header">
            @Html.Partial("Patial/Layout/_Header")
        </header>
        <div id="featured-download">
            <div class="col-full">
                <form action="/" method="get" id="fr-searchvideo">
                    <div class="main-search">
                        <div class="video-url">
                            <input type="text" name="url" id="urlvideo" class="input-block-level" placeholder="Enter the link video youtube here: e.g http://www.youtube.com/watch?v=bMUxpTb_wWc" />
                        </div>
                        <div class="get-video">
                            <input type="submit" value="Download" class="submit button" />
                        </div>
                    </div>
                </form>
            </div>
            @if (!string.IsNullOrEmpty(ViewBag.Error))
            {
                <div class="col-full">
                    <div class="video-error">
                        @ViewBag.Error
                    </div>
                </div>
            }
            @if (videos != null && videos.Any())
            {
                var video = videos[0];
                <script> $(document).ready(function () { CreateYoutube('@video.VideoTitle', '@ViewBag.VideoID', '@ViewBag.Time'); });</script>
                <div class="col-full">
                    <div class="video-result">
                        <div class="img-video">
                            <img src="http://i3.ytimg.com/vi/@(ViewBag.VideoID)/0.jpg" alt="@video.VideoTitle"/>
                        </div>
                        <div class="video-info">
                            <table class="table-video-info">
                                <tbody>
                                    <tr>
                                        <td class="name">Title:</td>
                                        <td>
                                            @video.VideoTitle
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="name">Duration:</td>
                                        <td>@ViewBag.Time</td>
                                    </tr>
                                    <tr>
                                        <td class="name">Watch video:</td>
                                        <td><a href="@AppSettings.CurrentDomain/video/@(ViewBag.VideoID).html" target="_blank">@AppSettings.CurrentDomain/video/@(ViewBag.VideoID).html</a></td>
                                    </tr>
                                </tbody>
                            </table>
                            <h3>Download from list below:</h3>
                            <ul class="video-downloads">
                                @foreach (var item in videos)
                                {
                                    //var videoDimension = WebsiteController.formatSize(item.Dimension);
                                    //var videoSize = WebsiteController.formatSizeBinary(item.VideoSize);
                                    <li><a href="@item.DownloadUrl" title="Click to download">Download @item.Extention</a></li>
                                }
                            </ul>
                        </div>
                    </div>
                </div>
            }
            <div class="col-full ajax-search">
            </div>
            <div class="like-tool">
                @*<div class="likename">Thank us:</div>*@
                <div class="fb-share">
                    <div class="fb-like" data-href="http://www.getlinkyoutube.com" data-layout="button_count" data-action="like" data-show-faces="false" data-share="false"></div>
                </div>
                <div class="g-share">
                    <div class="g-plusone" data-size="medium" data-href="http://www.getlinkyoutube.com"></div>
                </div>
                <div class="twitter-share">
                    <a href="https://twitter.com/share" data-url="http://www.getlinkyoutube.com" class="twitter-share-button" data-via="getlinkyoutube">Tweet</a>
                </div>
            </div>
            <!--/.col-full-->
        </div>
        <!--/#featured-download-->
        <div id="content" class="col-full">
            @RenderBody()
            @if (!rawUrl.StartsWith("/watch") && !rawUrl.StartsWith("/?url") && !rawUrl.Equals("/"))
            {
                @Html.Partial("Patial/Layout/_SideBarLeft")
            }
        </div>
        <div id="footer-wrapper">
            @Html.Partial("Patial/Layout/_Footer")
        </div>
        <!-- /#footer-wrapper -->
    </div>
    <!-- /#wrapper -->
    @Html.Raw(AppSettings.FacebookSDK)
    @Html.Raw(AppSettings.GooglePlus)
    @Html.Raw(AppSettings.AddThis)
    <script>!function (d, s, id) { var js, fjs = d.getElementsByTagName(s)[0], p = /^http:/.test(d.location) ? 'http' : 'https'; if (!d.getElementById(id)) { js = d.createElement(s); js.id = id; js.src = p + '://platform.twitter.com/widgets.js'; fjs.parentNode.insertBefore(js, fjs); } }(document, 'script', 'twitter-wjs');</script>
    <script type="text/javascript">document.write(unescape("%3Cscript src=%27http://s10.histats.com/js15.js%27 type=%27text/javascript%27%3E%3C/script%3E"));</script>
    <a href="http://www.histats.com" target="_blank" title="website hit counter">
        <script type="text/javascript">
            try {
                Histats.start(1, 2735450, 4, 0, 0, 0, "");
                Histats.track_hits();
            } catch (err) { };
        </script>
    </a>
</html>
